<!DOCTYPE html>
<html>
<head>
    <title></title>
    <meta http-equiv="content-type" content="text/html;charset=utf-8">
    <link rel="stylesheet" href="css/tableRound.css">
    <link rel="stylesheet" href="css/bootstrap.css">
    <link rel="stylesheet" href="css/bootstrap-table.css">
    <style>
        .fixed-table-toolbar{
            display: inline-block;
            position: fixed;
            top: 52px;
            right: 20px;
        }

        .fixed-table-toolbar .search{
            margin: 0;
        }

        .fixed-table-toolbar .form-control{
            height: 28px;
        }

    </style>
</head>
<body>
<div id="coverTable">
    <select id="coverTableSelect"></select>
    <select id="coverTableType"></select>
    <select id="coverTablevillage"></select>
    <input class="query-pulp" id="query1" type="button" value="查询">
    <div class="search-data">
        <input class="query-pulp" id="query2" type="button" value="查询配置">
    </div>
    <div id="search-data">
        <ul>
            <li>
                <input type="checkbox" id="searchSexIpt" name="searchSex">
                <label for="searchSexIpt">性别</label>
                <span> = </span>
                <select id="searchSex">
                    <option value="">空</option>
                    <option value="1">男</option>
                    <option value="0">女</option>
                </select>
            </li>
            <li>
                <input type="checkbox" id="searchIsLinkIpt" name="searchIsLink">
                <label for="searchIsLinkIpt">是否被链接</label>
                <span> = </span>
                <select id="searchIsLink">
                    <option value="">空</option>
                    <option value="1">是</option>
                    <option value="0">否</option>
                </select>
            </li>
            <li>
                <input type="checkbox" id="searchAgeIpt1" name="searchAge">
                <label for="searchAgeIpt1">年龄</label>
                <span> >= </span>
                <input id="searchAge1" class="number1" type="number" min="18" max="56">
            </li>
            <li>
                <input type="checkbox" id="searchAgeIpt2" name="searchAge">
                <label for="searchAgeIpt2">年龄</label>
                <span> < </span>
                <input id="searchAge2" class="number2" type="number" min="18" max="56">
            </li>
            <li>
                <input type="checkbox" id="searchPulpAgeIpt1" name="searchPulpAge">
                <label for="searchPulpAgeIpt1">浆龄</label>
                <span> >= </span>
                <input id="searchPulpAge1" class="number1"  type="number" min="0" max="38">
            </li>
            <li>
                <input type="checkbox" id="searchPulpAgeIpt2" name="searchPulpAge">
                <label for="searchPulpAgeIpt2">浆龄</label>
                <span> < </span>
                <input id="searchPulpAge2" class="number2"  type="number" min="0" max="38">
            </li>
            <li>
                <input type="checkbox" id="searchThisYTimesIpt1" name="searchThisYTimes">
                <label for="searchThisYTimesIpt1">今年当期总次数</label>
                <span> >= </span>
                <input id="searchThisYTimes1" class="number1"  type="number" min="0" max="27">
            </li>
            <li>
                <input type="checkbox" id="searchThisYTimesIpt2" name="searchThisYTimes">
                <label for="searchThisYTimesIpt2">今年当期总次数</label>
                <span> < </span>
                <input id="searchThisYTimes2" class="number2" type="number" min="0" max="27">
            </li>
            <li>
                <input type="checkbox" id="searchQuYTimesIpt1" name="searchQuYTimes">
                <label for="searchQuYTimesIpt1">去年同期总次数</label>
                <span> >= </span>
                <input id="searchQuYTimes1" class="number1"  type="number" min="0" max="27">
            </li>
            <li>
                <input type="checkbox" id="searchQuYTimesIpt2" name="searchQuYTimes">
                <label for="searchQuYTimesIpt2">去年同期总次数</label>
                <span> < </span>
                <input id="searchQuYTimes2" class="number2"  type="number" min="0" max="27">
            </li>
            <li>
                <input type="checkbox" id="searchQuYAllTimesIpt1" name="searchQuYAllTimes">
                <label for="searchQuYAllTimesIpt1">去年献浆总次数</label>
                <span> >= </span>
                <input id="searchQuYAllTimes1" class="number1" type="number" min="0" max="27">
            </li>
            <li>
                <input type="checkbox" id="searchQuYAllTimesIpt2" name="searchQuYAllTimes">
                <label for="searchQuYAllTimesIpt2">去年献浆总次数</label>
                <span> < </span>
                <input id="searchQuYAllTimes2" class="number2" type="number" min="0" max="27">
            </li>
            <li>
                <input type="checkbox" id="searchAllTimesIpt1" name="searchAllTimes">
                <label for="searchAllTimesIpt1">献浆总次数</label>
                <span> >= </span>
                <input id="searchAllTimes1" class="number1" type="number" min="0" max="963">
            </li>
            <li>
                <input type="checkbox" id="searchAllTimesIpt2" name="searchAllTimes">
                <label for="searchAllTimesIpt2">献浆总次数</label>
                <span> < </span>
                <input id="searchAllTimes2" class="number2" type="number" min="0" max="963">
            </li>
        </ul>
        <button>查询</button>
    </div>
    <button class="submit-table">提交修改</button>
    <div class="show-title">
        <h1></h1>
    </div>
    <div class="table-responsive">
        <table id="thisTown" class="table"></table>
    </div>
    <div class="table-responsive">
        <table id="table"></table>
    </div>
</div>
<div id="popup" class="popup" style="display: none;">
    <h1></h1>
    <img src="images/close.png" width="27px" onclick="closePopup()" alt="关闭">
    <div class="popup-content"></div>
</div>
<div id="popup1" class="popup" style="display: none;">
    <h1></h1>
    <img src="images/close.png" width="27px" onclick="closePopup1()" alt="关闭">
    <div class="popup-content"></div>
</div>
</body>
<script src="js/jquery.min.js"></script>
<script src="js/echarts4.min.js"></script>
<script src="js/bootstrap.js"></script>
<script src="js/bootstrap-table.js"></script>
<script src="js/template.js"></script>
<script src="js/vii-placeholder.js"></script>
<script src="js/common.js"></script>
<script src="js/tableCommon.js"></script>
<script>

    /*
    * search-data
    * 失去焦点checkbox 选中
    * */
    $("#search-data input[type=number],#search-data input[type=text],#search-data select").on("blur",function () {
        $(this).parent().find("input[type=checkbox]").prop("checked",true);
    });


    /*
    * getValue
    * 获取配置项的区间值
    * */
    function getValue(ele) {
        var data = [];
        ele.each(function () {
            data[$(this).parent().find("input[type=number]").attr("class")] =  $(this).parent().find("input[type=number]").val();
        });
        if (data.number1 && !(data.number2) ) {
            return data.number1+','+ele.parent().find("input[type=number]").attr("max");
        } else  if (!(data.number1) && data.number2) {
            return ele.parent().find("input[type=number]").attr("min")+','+data.number2;
        } else if (data.number1 && data.number2) {
            return data.number1+','+data.number2;
        }
    }


    /*--------------------  数据请求 ------------------------------------------------------------*/

    /*
    * queryConfiguration
    * 查询配置项
    * */
    function queryConfiguration(data, callback) {
        $.ajax({
            url: "http://60.164.210.223:7577/Nvr/map/getLc",
            dataType: "jsonp",
            data: data,
            beforeSend: function () {
                placeholder.show(document.body);
            },
            success: function (item) {
                callback(item)
            },
            error: function (error) {
                alert("查询配置项请求失败！");
                placeholder.hide(document.body);
                $(".vii-holder-mask").hide();
            }
        });
    }



    /*------------ 查询 ------------------------------------------------------------------------*/

    /*
    * query2
    * 查询数据
    * */
    $("#query2").on("click", function () {
        $("#search-data").toggle();
        autoCenter($("#search-data"));
        dragPopup("#search-data");
    });

    /*
    * 配置项查询
    * search-data button
    * */
    $("#search-data button").on("click", function () {
        var sex = $("input[name=searchSex]").prop("checked") ? $("#searchSex").val() : "";
        var manageNurse = $("input[name=searchIsLink]").prop("checked") ? $("#searchIsLink").val() : "";
        var age =   $("input[name=searchAge]:checked").length > 0 ? getValue($("input[name=searchAge]:checked")) : "18,56";
        var searchPulpAge =  $("input[name=searchPulpAge]:checked").length > 0 ? getValue( $("input[name=searchPulpAge]:checked")) : "0,38";
        var searchThisYTimes = $("input[name=searchThisYTimes]:checked").length > 0 ? getValue( $("input[name=searchThisYTimes]:checked")) : "0,27";
        var searchQuYTimes =  $("input[name=searchQuYTimes]:checked").length > 0 ? getValue( $("input[name=searchQuYTimes]:checked")) : "0,27";
        var searchQuYAllTimes =  $("input[name=searchQuYAllTimes]:checked").length > 0 ? getValue( $("input[name=searchQuYAllTimes]:checked")) : "0,27";
        var searchAllTimes = $("input[name=searchAllTimes]:checked").length > 0 ? getValue( $("input[name=searchAllTimes]:checked")) : "0,963";

        $("#search-data").hide();
        var data = {
            getLc: "",
            nurseId: $("#coverTableSelect").val(),
            gjzType: $("#coverTableType").val(),
            address: ($("#coverTablevillage").val() === "所有村落" ? "" : $("#coverTablevillage").val()),
            manageNurse: manageNurse,
            sex: sex,
            age: age,
            pulpAge: searchPulpAge,
            currentTimePulp: searchThisYTimes,
            lastTimePulps: searchQuYTimes,
            lastYearPulps: searchQuYAllTimes,
            times: searchAllTimes
        };
        queryConfiguration(data, function (item) {
            initTable(data,item);
        });
    });

</script>
</html>